package org.adorsys.aderp.aderplogin.repository;

import java.util.Date;
import java.util.List;

import org.adorsys.aderp.aderplogin.domain.AderpPersonRef;
import org.springframework.data.jpa.repository.Query;
import org.springframework.roo.addon.layers.repository.jpa.RooJpaRepository;

@RooJpaRepository(domainType = AderpPersonRef.class)
public interface AderpPersonRefRepository {
	public List<AderpPersonRef> findByPersonNumber(String personNumber);
	
//	@Query("select a from AderpPersonRef a where a.lastUpdate=(select max(a.lastUpdate) from a")
//	public AderpPersonRef getLastRecord();

	@Query("select max(a.lastUpdate) from AderpPersonRef a")
	public Date getLastUpdate();
	
	public List<AderpPersonRef> findByExternalRef(String externalRef);
}
